/*
 * @Author: szx
 * @Date: 2022-05-23 14:22:17
 * @LastEditTime: 2022-05-23 14:32:26
 * @Description:
 * @FilePath: \leetcode\面试题\08\06\06.js
 */
/**
 * @param {number[]} A
 * @param {number[]} B
 * @param {number[]} C
 * @return {void} Do not return anything, modify C in-place instead.
 */
var hanota = function (A, B, C) {
    const move = (n, from, buffer, to) => {
        // 移动n层汉诺塔
        if (n === 1) {
            to.push(from.pop());
        } else {
            move(n - 1, from, to, buffer);
            move(1, from, buffer, to);
            move(n - 1, buffer, from, to);
        }
    };
    move(A.length, A, B, C);
};
